<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="dao.*,entity.*,util.*"%>
<%@ include file="CheckLogin.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新闻首页</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style>
	#ul1{
		list-style:none;
		width:53%;
		border:1px solid blue;
		height:110px;
		padding-left:0px;
	}
	#li1{
		float:left;
		font-size:20px;
		padding:3px;
		color:blue;
		margin:0px 20px 0px 20px;
		font-weight:600;
		
	}
	#a1{
		text-decoration:none;
	}
	#a1:hover{
		color:red;
		text-decoration:underline;
	}
	#ul2{
		width:50%;
		border:1px solid blue;
	}
	#date{
		float:right;
	}
	#li2{
		margin-top:5px;
	}
	
	</style>
  </head>
  
  
  <body>
  <ul id="ul1">
  	<%
  		String name=(String)session.getAttribute("USER");
  		TopicDao topicdao=new TopicDao();
  		List<Topic> list=topicdao.findAll();
  		out.print(name);
  		for(Topic topic:list){
  	 %>
  	 	
  	 	<li id="li1"><a href="#" id="a1" ><%=topic.getTname()%></a></li>
  	 <%}%>
   </ul>
   <ul id="ul2">
  	 <%
  	 	NewsDao newsdao=new NewsDao();
		List<News> listNews=newsdao.search(1);
		for(News news:listNews){
  	  %>
  	  	<li id="li2"><a href="#" id="a1" ><%=news.getNtitle() %></a><span id="date"><%=news.getNcreateDate() %><span></li>
  	  <%} %>
  </body>
</html>
